Q: What does the interpreter do when you reference variables in other scopes?
Solution: The interpreter executes the javascript code. Normally when you reference variables in other scopes at the global level, in other namespaces, and so on—the interpreter needs to traverse the stack to get to the variable.
Q: The attribute location belongs to which element?
Solution: window.location.href returns the href (URL) of the current page. The attribute location belongs to the document element.
Q: What will happen if you reference document.location from within an object?
Solution: window.location.href returns the href (URL) of the current page. If you reference document.location from within an object, the interpreter will need to go from the function that references the variable, up out of the namespace to the global window scope, down to the document scope, and gets the location value.
Q: Why do we need to create locally scoped variables to hold value?
Solution: window.location.assign loads a new document. The locally scoped variables are created to cache the reference to document.location.
Q: What is the next step after calling the startTimeLogging()?
Solution: The startTimeLogging() method captures the timing data for ad hoc, etc for referencing an uncached document.location. Once the startTimeLogging() method is called, run the code to test.
Q: During the traversing through the stack, where does it go after it goes to the namespace?
Solution: Namespace in JavaScript is nothing but a single global object which will contain all our functions, methods, variables and all that. During the traversal in the stack manner, after going to the namespace, it goes to the Window.
Q: During the traversing through the stack, where does it go after it goes to the window?
Solution: window.location.assign loads a new document. During the traversal in the stack manner, after going to the window, it goes nowhere.
Q: During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the namespace?
Solution: Namespace in JavaScript is nothing but a single global object which will contain all our functions, methods, variables and all that. When you create a locally scoped variable for caching the reference, the traversal reverses in the forward direction and thus, after going to the namespace, it goes to the function.
Q: What is the function used to stop capturing the ad hoc timing ?
Solution: The startTimeLogging() method captures the timing data for ad hoc, etc for referencing an uncached document.location. In order to stop capturing the ad hoc timing for referencing uncached document.location, we call the method stopTimeLogging().
Q: During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the location?
Solution: window.location.assign loads a new document. When you create a locally scoped variable for caching the reference, the traversal reverses in the forward direction and thus, after going to the location, it goes nowhere.
You Have Score    | /10 |